<?php
/**
 * Yii view files
 *
 * @author <KTD SOFT>
 * @since May 18, 2013 - 2:34:30 PM
 */
?>
<ul>
    <?php foreach ($files['contents'] as $f): ?>
        <?php if ($f['fType'] == 'folder'): ?>
            <?php if ($f['fName'] == '..') continue; ?>
            <li id='<?php echo md5($f['fPath']); ?>'>
                <a title="<?php echo $f['fName'] ?>" 
                   onclick="activeFolder($(this))"
                   data="<?php echo $f['fPath']; ?>"
                   class="link_folder">
                    <div class="file_preview">
                        <img src="<?php echo $this->asset . "/images/folder.svg"; ?>" 
                             style="max-width: 50px;max-height: 50px;"/>
                    </div>
                    <div class="file_name">
                        <?php echo substr($f['fName'], 0, 10); ?>
                    </div>
                </a>
                <div class="folder_child"></div>
            </li>
        <?php endif; ?>
    <?php endforeach; ?>
    <?php foreach ($files['contents'] as $f): ?>
        <?php if (in_array($f['fType'], array('png', 'jpg', 'gif', 'PNG', 'JPG', 'GIF'))): ?>
            <li id='<?php echo md5($f['fPath'] . $f['fName']); ?>'>
                <a title="<?php echo $f['fName'] ?>" 
                   class="file_link" onclick="activeFile($(this))" 
                   data="<?php echo $f['fPath']; ?>">
                    <div class="file_preview">
                        <img src="<?php echo Yii::app()->baseUrl . "/" . $f['fPath']; ?>" 
                             style="max-width: 50px;max-height: 50px;"/>
                    </div>
                    <div class="file_name">
                        <?php echo substr($f['fName'], 0, 10); ?>
                    </div>
                </a>                        
            </li>
        <?php endif; ?>
    <?php endforeach; ?>
</ul>